package com.diligent.cloud.printer.client.service;

import com.diligent.cloud.primary.data.model.Result;
import com.diligent.cloud.printer.client.config.FeignMultipartSupportConfig;
import com.diligent.cloud.printer.client.fallback.PrinterFeignFallback;
import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * @description:
 * @author: chenluqiang
 * @time: 2020-07-03:12:10
 */
@FeignClient(value = "diligent-cloud-printer-server", path = "/printer", fallback = PrinterFeignFallback.class //,url = "http://localhost:10006"
                        ,configuration = FeignMultipartSupportConfig.class)
public interface PrinterFeignService {
    @PostMapping(value = "/printFile",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    ResponseEntity<Result> printFile(@RequestPart("file") MultipartFile file,@RequestParam("printerName") String printerName);

}
